home *** CD-ROM | disk | FTP | other *** search
/ Amiga Format CD 46 / Amiga Format CD46 (1999-10-20)(Future Publishing)(GB)[!][issue 1999-12].iso / -serious- / programming / other / tandem / teaching / 48.asm < prev    next >
Assembly Source File  |  1999-09-06  |  2KB  |  81 lines

  1. * Teaching/48.asm        version 0.00  16.9.97     datatypes
  2.  
  3.  include 'Front.i'
  4.  
  5. dbbase: ds.l 1
  6. object: ds.l 1
  7.  
  8. strings: dc.b 0
  9. st_1: dc.b 'Picture Window',0 ;1
  10.  dc.b 'datatypes.library',0 ;2
  11. st_3: dc.b 'WORK2:Art/ClipArt1/Comput2.iff',0 ;3
  12.  dc.b 'Can''t open datatypes.library',0 ;4
  13.  dc.b 'Can''t open window',0 ;5
  14.  dc.b 'Can''t get object',0 ;6
  15.  ds.w 0
  16.  
  17. Program:
  18.  TLstrbuf #2
  19.  move.l xxp_sysb(a4),a6
  20.  move.l a4,a1
  21.  moveq #37,d0
  22.  jsr _LVOOpenLibrary(a6)
  23.  move.l d0,dbbase
  24.  beq Pr_bad
  25.  TLwindow #0,#0,#0,#640,#200,#640,#200,#0,#st_1
  26.  beq.s Pr_bad2
  27.  bsr Picture
  28.  beq Pr_bad3
  29. Pr_quit:
  30.  move.l xxp_sysb(a4),a6
  31.  move.l dbbase,a1
  32.  jsr _LVOCloseLibrary(a6)
  33.  rts
  34. Pr_bad:
  35.  TLbad #4
  36.  rts
  37. Pr_bad2:
  38.  TLbad #5
  39.  bra Pr_quit
  40. Pr_bad3:
  41.  TLbad #6
  42.  bra Pr_quit
  43.  
  44. * load a picture using datatypes
  45. Picture:
  46.  subq.l #4,a7              ;create object
  47.  move.l a7,a0
  48.  move.l #TAG_END,(a0)
  49.  move.l dbbase,a6
  50.  move.l #st_3,d0
  51.  jsr _LVONewDTObjectA(a6)
  52.  addq.l #4,a7
  53.  move.l d0,object
  54.  beq Pi_bad
  55.  move.l xxp_AcWind(a4),a5  ;attach object
  56.  move.l xxp_Window(a5),a0
  57.  sub.l a1,a1
  58.  move.l object,a2
  59.  moveq #-1,d0
  60.  jsr _LVOAddDTObject(a6)
  61.  
  62.  move.l xxp_intb(a4),a6
  63.  move.l xxp_Window(a5),a1
  64.  sub.l a2,a2
  65.  move.l wd_FirstGadget(a1),a0
  66.  moveq #-1,d0
  67.  jsr _LVORefreshGList(a6)
  68.  
  69.  TLkeyboard                ;wait for response
  70.  move.l xxp_Window(a5),a0  ;remove from window
  71.  move.l object,a1
  72.  move.l dbbase,a6
  73.  jsr _LVORemoveDTObject(a6)
  74.  move.l object,a0          ;dispose of object
  75.  jsr _LVODisposeDTObject(a6)
  76.  moveq #-1,d0
  77.  rts
  78. Pi_bad:
  79.  moveq #0,d0            ;EQ if bad
  80.  rts
  81.